Skip to content

Conversation

@jeffredodd
Copy link
Contributor

@jeffredodd jeffredodd commented Jan 8, 2026

Summary

This PR migrates the SDK's component development environment from Ladle to Storybook 8.6.15.

Goal

Port existing Ladle functionality to Storybook — this is NOT an effort to implement new Storybook features. The goal is a 1:1 migration that maintains our existing development workflow while moving to a more widely-adopted tool with better long-term support.

Testing

Used cursor + playwright MCP to get us to 100% matching between chromeless screenshots of stories

Screenshot 2026-01-08 at 1 16 32 PM

What Changed

Added

  • .storybook/ configuration directory:
    • main.ts — Story discovery patterns, addons, Vite config
    • preview.tsx — Global decorators with providers, component adapter toolbar toggle
    • helpers/FormWrapper.tsx — Form wrapper with Storybook actions integration
    • helpers/useStoryState.tsx — State management helper for interactive stories
    • helpers/MockBaseProvider.tsx — Mock provider for stories needing BaseContext
    • adapters/PlainComponentAdapter.tsx — Plain HTML component adapter (migrated from Ladle)
    • static/demo-images/ — Static assets for stories
  • Storybook dependencies (@storybook/* 8.6.15, storybook-dark-mode)
  • npm scripts: storybook, build-storybook
  • .gitignore entries for storybook-static/ and *storybook.log

Modified

  • 69 story files — Converted from Ladle's Story<T> format to Storybook CSF3 (Meta/StoryObj)
  • tsconfig.json — Updated paths from .ladle to .storybook
  • vite.config.ts — Updated exclusion patterns for .storybook
  • eslint.config.mjs — Added .storybook/**/* to ignores
  • CONTRIBUTING.md — Updated developer instructions to use npm run storybook
  • package.json — Added Storybook deps, removed @ladle/react

Removed

  • .ladle/ directory and all Ladle configuration
  • @ladle/react dependency
  • ladle npm script

What Did NOT Change

  • No production code changes — All changes are in story files, config, and dev dependencies
  • No component logic changes — Stories render the same components as before
  • No test changes — Unit tests remain untouched (all 1018 tests pass)
  • No build output changes — SDK build produces identical output

Verification

Check Status
TypeScript (npm run tsc) ✅ Pass
ESLint (npm run lint:check) ✅ Pass
Prettier (npm run format:check) ✅ Pass
Unit tests (npm run test -- --run) ✅ Pass (1018 tests)
SDK build (npm run build) ✅ Pass
Storybook build (npm run build-storybook) ✅ Pass
Storybook smoke test ✅ Pass

⚠️ Review Notes

This migration was largely AI-assisted. While all automated checks pass and manual spot-checks have been performed, reviewers should:

  1. Spot-check story files — Verify a sampling of stories render correctly in Storybook
  2. Test the component adapter toggle — Toolbar should switch between React Aria and Plain HTML
  3. Verify interactive stories — Form fields, state changes, etc. work as expected

The risk is mitigated by:

  • No production code was modified
  • All existing tests continue to pass
  • Story files are development-only and don't affect the published SDK

How to Test

npm install
npm run storybook
# Visit http://localhost:6006

@socket-security
Copy link

socket-security bot commented Jan 8, 2026

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring alerts on:

View full report

@jeffredodd
Copy link
Contributor Author

@SocketSecurity ignore npm/[email protected]

@jeffredodd
Copy link
Contributor Author

@SocketSecurity ignore npm/[email protected]

- Replace @ladle/react with Storybook 8.6.15
- Convert all 69 story files from Ladle's Story<T> format to Storybook CSF3
- Add .storybook/ configuration with providers, component adapter toolbar
- Migrate helpers: FormWrapper, PlainComponentAdapter, add useStoryState
- Update tsconfig.json, vite.config.ts, eslint.config.mjs for .storybook paths
- Update CONTRIBUTING.md with Storybook instructions
- Add storybook-static/ and *storybook.log to .gitignore
@jeffredodd jeffredodd marked this pull request as ready for review January 8, 2026 21:23
Copilot AI review requested due to automatic review settings January 8, 2026 21:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR successfully migrates the SDK's component development environment from Ladle to Storybook 8.6.15, maintaining a 1:1 functional parity while adopting a more widely-supported tooling ecosystem. The migration includes configuration setup, helper utilities, and conversion of 69 story files from Ladle's format to Storybook's CSF3 format.

Key changes:

  • Replaced Ladle with Storybook 8.6.15 and configured addons (essentials, interactions, a11y, dark mode)
  • Migrated all story files from action() to fn().mockName() pattern
  • Converted useLadleState to useStoryState for state management in stories
  • Updated component adapter toggle from floating button to Storybook toolbar

Reviewed changes

Copilot reviewed 73 out of 78 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.storybook/main.ts Storybook configuration with Vite integration and addon setup
.storybook/preview.tsx Global decorators with providers and component adapter toolbar
.storybook/helpers/* Migrated helper utilities (FormWrapper, useStoryState, MockBaseProvider)
.storybook/adapters/PlainComponentAdapter.tsx Migrated plain HTML component adapter
package.json Added Storybook dependencies, removed Ladle
vite.config.ts Updated exclusion patterns from .ladle to .storybook
tsconfig.json Updated path aliases from ~ladle/* to ~storybook/*
eslint.config.mjs Added .storybook/**/* to ignores
69 story files Converted from Ladle format to Storybook CSF3 format
.ladle/* Removed all Ladle configuration and helpers
CONTRIBUTING.md Updated developer instructions to use Storybook
.gitignore Added Storybook build output entries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@serikjensen serikjensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good thanks for taking this on! left a few comments

Comment on lines 25 to 32
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
additionalData: `@use "@/styles/Helpers" as *; @use '@/styles/Responsive' as *;\n`,
},
},
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we import our codebase CSS config here so that changes to our codebase config don't result in breaking storybook?

Comment on lines 22 to 24
<I18nextProvider i18n={SDKI18next}>
<LocaleProvider locale="en-US" currency="USD">
<ThemeProvider>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These providers are already set in GustoProviderCustomUIAdapter. looks like you can just set the props on that and remove these?

}

export default {
const meta: Meta<typeof BadgeWrapper> = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: any reason this is getting changed to meta and then using the default export? Vs. the other default exports? just wondering since if there's a needed change here i'm not seeing it on the other exports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, i'll look into that one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants